<?php
require_once './include/common.inc.php';
require_once './include/admin.inc.php';
require_once './include/image.func.php';
$filename = $file_filedata['name'];
if(!ispicture($filename)) debug($lan['pictureexterror'], 1, 1);
$newfilename = get_upload_filename($filename, 0, 0, 'image');
uploadfile($file_filedata['tmp_name'], FORE_ROOT.$newfilename);
$modules = getcache('modules');
operateuploadpicture(FORE_ROOT.$newfilename, $modules[akgetcookie('lastmoduleid')]);
$picurl = $homepage.$newfilename;
$db->insert('attachments', array('itemid' => $get_id, 'filename' => $newfilename, 'filesize' => filesize(FORE_ROOT.$newfilename), 'dateline' => $thetime, 'originalname' => $filename));
$msg = "{'url':'".$picurl."','localname':'".$newfilename."','id':'1'}";
exit("{'err':'','msg':".$msg."}");
?>